#include<iostream>
#include"list.cpp"
#include<cmath>
using namespace std;
Plural::Plural()
{
}
Plural::Plural(double a, double b)
{
	t = a;
	f = b;
}
Plural::Plural(const Plural& p1)
{
	t = p1.t;
	f = p1.f;
}
Plural::~Plural()
{
}
 Plural Plural::Plus(Plural p1)
{
	 Plural p2;
	 p2.t = p1.t + t;
	 p2.f = p1.f + f;
	 return p2;
}
 Plural Plural::Minus(Plural p1)
 {
	 Plural p2;
	 p2.t = t - p1.t;
	 p2.f = f - p1.f;
	 return p2;
 }
 Plural Plural::Multiply(Plural p1)
 {
	 Plural p2;
	 p2.t = t * p1.t-f*p1.f;
	 p2.f = f * p1.t + t * p1.f;
	 return p2;
 }
 int Plural::Judgement()
 {
	 if (t)
		 return 1;
	 else
		 return 0;
 }
 Plural Plural::Divide(Plural p1)
 {
	 Plural p2;
	 p2.t = (t * p1.t + f * p1.f) / (pow(f, 2) + pow(p1.f, 2));
	 p2.f = (f * p1.t - t * p1.f) / (pow(f, 2) + pow(p1.f, 2));
	 return p2;
 }
 void Plural::Display()
 {
	 cout << "The result is " << t << "+" << f << "i" << endl;
 }